jQuery(document).ready(function() {
	//创建JQGRID表格
	//var grid = 
	$("#table1").ligerGrid({
        columns: [
                  { display: 'id', name: 'id', hide:1, width:1 },
                  { display: '单据编号', name: 'no', width: 130 },
                  { display: '源单编号', name: 'sourceBliiNo', width: 130},
                  { display: '物料ID', name: 'materialsid', width: 1,hide:true},
                  { display: '物料编号', name: 'code', width: 110},
                  { display: '物料名称', name: 'name', width: 80},
                  { display: '物料等级', name: 'status', width: 80
                	  ,render: function (item){
	            		  var state=item.status;
	            		  if(state=="1"){
	            			  return "一等品";
	            		  }
	            		  if(state=="2"){
	            			  return "次品";
	            		  }
	            		  if(state=="3"){
	            			  return "旧件";
	            		  }
	            	  	}
                  },
                  { display: '处理状态', name: 'billStatus', width: 80,
                	render : function(item){
                		if (item.billStatus == 0)
                			return "未处理";
                		if (item.billStatus == 1)
                			return "部分处理";
                		if (item.billStatus == 2)
                			return "已处理";
                	}  
                  },
                  { display: '基本单位', name: 'unit', width: 80},
                  { display: '基本单位数量', name: 'jquantity', width: 100},
                  { display: '仓库编码', name: 'whcode',width: 1,hide:true},
                  { display: '仓库名称', name: 'whname', width: 1,hide:true},
                  { display: '生成时间', name: 'dctime', width: 120,
                	  render: function (item){
                		  var cdate=new Date(item.dctime);
                		  return formatDate(cdate,"yyyy-MM-dd");
                	  }
                  },
                  //{ display: '备注', name: 'remark', width: 160},
                  { display: '最后处理时间', name: 'dutime', width: 120,
                	  render: function (item){
                		  if(undefined != item.dutime && null !=item.dutime){
                			  var cdate=new Date(item.dutime);
                    		  return formatDate(cdate,"yyyy-MM-dd");
                		  }
                	  }
                  },
                  { display: '最后处理人', name: 'duuser', width: 120 }
                  ],  
                  usePager: true,pageSize:15,
              	  pageSizeOptions :[15,25,35],
                  enabledSort:false,//hxm
                      url : basic_Url+"/list.do",
                      width: '100%', height: '98%', 
                      checkbox: true,rownumbers:true,
                      onDblClickRow : function (data, rowindex, rowobj){
                          //edit(data);
                       }
                  });
	
	$("#pageloading").hide();
	
	
});

/*function checkdel(){
	var manager = $("#table1").ligerGetGridManager(); 
	var rows =manager.getSelectedRows();
	if (rows==null || 0 == rows.length){
			$.dialog.alert('请选择需要操作删除的行！');
			return;
		}
	var canDel = true;
		$(rows).each(function() {
			if (this.billStatus!=0){
				canDel = false;
				$.dialog.alert('此行不能进行删除操作！');
			}
		});
		
		if(canDel){
			del();
		}	
}*/
